/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.max.oti.system.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 *
 * @author max
 */
@Entity
@Table(name = "state", catalog = "dbfiis", schema = "public")
@XmlRootElement
public class State implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "name_entity")
    private String nameEntity;
    @Size(max = 300)
    @Column(name = "detail")
    private String detail;
    @OneToMany(mappedBy = "idState")
    private List<HistoryTitle> historyTitleList = new ArrayList<HistoryTitle>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<Comission> comissionList = new ArrayList<Comission>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<ExamSufficiency> examSufficiencyList = new ArrayList<ExamSufficiency>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<Member1> member1List = new ArrayList<Member1>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<ReportPractice> reportPracticeList = new ArrayList<ReportPractice>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<PlaningTesis> planingTesisList = new ArrayList<PlaningTesis>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<User> userList = new ArrayList<User>();
    @OneToMany(mappedBy = "idState")
    @Cascade({CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE, CascadeType.DELETE})
    private List<HistoryPractice> hitoryPracticeList = new ArrayList<HistoryPractice>();
    
    public State() {
    }

    public State(Integer id) {
        this.id = id;
    }

    public State(Integer id, String name, String nameEntity) {
        this.id = id;
        this.name = name.toUpperCase();
        this.nameEntity = nameEntity;
    }

    public State(String name, String nameEntity, String detail) {
        this.name = name.toUpperCase();
        this.nameEntity = nameEntity;
        this.detail = detail;
    }
    
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name.toUpperCase();
    }

    public String getNameEntity() {
        return nameEntity;
    }

    public void setNameEntity(String nameEntity) {
        this.nameEntity = nameEntity;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    @XmlTransient
    public List<HistoryTitle> getHistoryTitleList() {
        return historyTitleList;
    }

    public void setHistoryTitleList(List<HistoryTitle> historyTitleList) {
        this.historyTitleList = historyTitleList;
    }

    @XmlTransient
    public List<Comission> getComissionList() {
        return comissionList;
    }

    public void setComissionList(List<Comission> comissionList) {
        this.comissionList = comissionList;
    }

    @XmlTransient
    public List<ExamSufficiency> getExamSufficiencyList() {
        return examSufficiencyList;
    }

    public void setExamSufficiencyList(List<ExamSufficiency> examSufficiencyList) {
        this.examSufficiencyList = examSufficiencyList;
    }

    @XmlTransient
    public List<Member1> getMember1List() {
        return member1List;
    }

    public void setMember1List(List<Member1> member1List) {
        this.member1List = member1List;
    }

    @XmlTransient
    public List<ReportPractice> getReportPracticeList() {
        return reportPracticeList;
    }

    public void setReportPracticeList(List<ReportPractice> reportPracticeList) {
        this.reportPracticeList = reportPracticeList;
    }

    @XmlTransient
    public List<PlaningTesis> getPlaningTesisList() {
        return planingTesisList;
    }

    public void setPlaningTesisList(List<PlaningTesis> planingTesisList) {
        this.planingTesisList = planingTesisList;
    }

    @XmlTransient
    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
    
    @XmlTransient
    public List<HistoryPractice> getHitoryPracticeList() {
        return hitoryPracticeList;
    }

    public void setHitoryPracticeList(List<HistoryPractice> hitoryPracticeList) {
        this.hitoryPracticeList = hitoryPracticeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof State)) {
            return false;
        }
        State other = (State) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.max.oti.system.model.State[ id=" + id + " ]";
    }
    
}
